home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Term / Extras / Source / gtlayout-source.lha / LTP_PlaceGroups.c < prev    next >
C/C++ Source or Header  |  1996-03-18  |  2KB  |  113 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. VOID
  15. LTP_PlaceGroups(LayoutHandle *handle,ObjectNode *group,LONG left,LONG top)
  16. {
  17.     if(!handle->Failed)
  18.     {
  19.         ObjectNode    *node;
  20.         LONG         plusLeft,
  21.                      plusTop,
  22.                      lastSpace;
  23.  
  24.         if(group->Label || group->Special.Group.Frame)
  25.         {
  26.             plusLeft = 4 + handle->GlyphWidth + handle->InterWidth + group->Special.Group.ExtraLeft;
  27.  
  28.             if(group->Label)
  29.                 plusTop = handle->GlyphHeight + handle->InterHeight + group->Special.Group.ExtraTop;
  30.             else
  31.                 plusTop = 2 + handle->InterHeight + group->Special.Group.ExtraTop;
  32.         }
  33.         else
  34.         {
  35.             plusLeft    = group->Special.Group.ExtraLeft;
  36.             plusTop     = group->Special.Group.ExtraTop;
  37.         }
  38.  
  39.         if(group->ExtraSpace)
  40.         {
  41.             if(group->Special.Group.ParentGroup->Special.Group.Horizontal)
  42.                 left += handle->InterWidth;
  43.             else
  44.                 top += handle->InterHeight;
  45.         }
  46.  
  47.         group->Left    = left;
  48.         group->Top    = top;
  49.  
  50.         left    += plusLeft;
  51.         top        += plusTop;
  52.  
  53.         if(group->Special.Group.Horizontal)
  54.         {
  55.             lastSpace = left;
  56.  
  57.             SCANGROUP(group,node)
  58.             {
  59.                 if(LIKE_STRING_KIND(node) && node->Special.String.LinkID != -1)
  60.                     handle->Count++;
  61.                 else
  62.                 {
  63.                     if(node->Type == GROUP_KIND)
  64.                         LTP_PlaceGroups(handle,node,lastSpace,top);
  65.                     else
  66.                     {
  67.                         node->Left    += left;
  68.                         node->Top    += top;
  69.  
  70.                         handle->Count++;
  71.                     }
  72.  
  73.                     if(!group->Special.Group.Paging)
  74.                     {
  75.                         lastSpace = node->Left + node->Width + handle->InterWidth;
  76.  
  77.                         if(node->Type == MX_KIND)
  78.                         {
  79.                             if((node->LabelPlace == PLACETEXT_RIGHT) || (node->LabelPlace == PLACETEXT_LEFT))
  80.                                 lastSpace += INTERWIDTH + node->Special.Radio.LabelWidth;
  81.                         }
  82.                     }
  83.                 }
  84.             }
  85.         }
  86.         else
  87.         {
  88.             lastSpace = top;
  89.  
  90.             SCANGROUP(group,node)
  91.             {
  92.                 if(LIKE_STRING_KIND(node) && node->Special.String.LinkID != -1)
  93.                     handle->Count++;
  94.                 else
  95.                 {
  96.                     if(node->Type == GROUP_KIND)
  97.                         LTP_PlaceGroups(handle,node,left,lastSpace);
  98.                     else
  99.                     {
  100.                         node->Left    += left;
  101.                         node->Top    += top;
  102.  
  103.                         handle->Count++;
  104.                     }
  105.  
  106.                     if(!group->Special.Group.Paging)
  107.                         lastSpace = node->Top + node->Height + handle->InterHeight;
  108.                 }
  109.             }
  110.         }
  111.     }
  112. }
  113.